﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Globalization;

namespace Chefbook.Views
{
	/// <summary>
	/// Interaction logic for IngredientEditView.xaml
	/// </summary>
    public partial class IngredientEditView
    {
        /// <summary>
        /// Interaction logic for IngredientEditView.xaml
        /// </summary>
        public IngredientEditView()
        {
            this.InitializeComponent();
        }
		
		
		public static readonly DependencyProperty SpacerWidthProperty = DependencyProperty.Register(
            "SpacerWidth", typeof(double), typeof(IngredientEditView), new PropertyMetadata(50d));
        public double SpacerWidth
        {
            get { return (double)SpacerColWidth.GetValue(Label.WidthProperty); }
            set { SpacerColWidth.SetValue(Label.WidthProperty, value); }
        }
		
        public static readonly DependencyProperty AmountWidthProperty = DependencyProperty.Register(
            "AmountWidth", typeof(double), typeof(IngredientEditView), new PropertyMetadata(75d));
        public double AmountWidth
        {
            get { return (double)AmountColWidth.GetValue(Label.WidthProperty); }
            set { AmountColWidth.SetValue(Label.WidthProperty, value); }
        }

        public static readonly DependencyProperty UnitsWidthProperty = DependencyProperty.Register(
            "UnitsWidth", typeof(double), typeof(IngredientEditView), new PropertyMetadata(75d));
        public double UnitsWidth
        {
            get { return (double)UnitsColWidth.GetValue(Label.WidthProperty); }
            set { UnitsColWidth.SetValue(Label.WidthProperty, value); }
        }

        public static readonly DependencyProperty NameWidthProperty = DependencyProperty.Register(
            "NameWidth", typeof(double), typeof(IngredientEditView), new PropertyMetadata(150d));
        public double NameWidth
        {
            get { return (double)NameColWidth.GetValue(Label.WidthProperty); }
            set { NameColWidth.SetValue(Label.WidthProperty, value -50d); }
        }
    }

    public class MouseOverVisibilityConverter : IValueConverter
    {

        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool isMouseOver = (bool)value;
            return isMouseOver ? Visibility.Visible : Visibility.Hidden;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}